{% extends "layout.html" %}
{% block title %}SNAT 新增{% endblock %}

{% block trail %}
        <li><a href="/">Home</a></li>
        <li><a href="{{ url_for('snat.index') }}">SNAT</a></li>
        <li class="current"><a href="{{ url_for('snat.add') }}">SNAT 新增</a></li>
{% endblock trail %}

{% block content %}
    <!-- start of side-nav -->
    <div id="side-nav" class="large-2 columns">
      <ul class="side-nav">
        <li><a href="{{ url_for('snat.index') }}"><i class="fi-list"> </i>SNAT 列表</a></li>
        <li class="active"><a href="{{ url_for('snat.add') }}"><i class="fi-plus"> </i>SNAT 新增</a></li>
      </ul>
    </div>
    <!-- end of side-nav -->

    <!-- start of snat add form -->
    <div class="large-10 columns end">
      {% with messages = get_flashed_messages(with_categories=true) %}
      {% if messages %}
      {% for category, message in messages %}
      <div data-alert class="alert-box {{ category }}">
        {{ message }}
        <a href="#" class="close">&times;</a>
      </div>
      {% endfor %}
      {% endif %}
      {% endwith %}
      <div data-alert class="alert-box info">
        注意：「转换后的IP」为本机私网IP，非本机绑定的公网地址或EIP 地址。
      </div>
      <form method='POST' action='/snat/add'>
        <div class="row">
          <div class="large-3 columns">
            {{ form.source.label(class="right inline") }}
          </div>
          <div class="large-5 columns end">
            {% if form.source.errors %}
            {{ form.source(class="error", value=form.source.value) }}
            <small class="error">{{ form.source.errors[0] }}</small>
            {% else %}
            {{ form.source(placeholder="10.8.8.0/24") }}
            {% endif %}
          </div>
        </div>
        <div class="row">
          <div class="large-3 columns">
            {{ form.gateway.label(class="right inline") }}
          </div>
          <div class="large-5 columns end">
            {% if form.gateway.errors %}
            {{ form.gateway(class="error", value=form.source.value) }}
            <small class="error">{{ form.gateway.errors[0] }}</small>
            {% else %}
            {{ form.gateway(placeholder="192.168.0.1") }}
            {% endif %}
          </div>
        </div>
        <div class="row">
            <div class="large-3 columns large-offset-3">
              <button class="tiny success">添加</button>
              <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
            </div>
          </div>
      </form>
    </div>
    <!-- start of snat add form -->
{% endblock content %}

